/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ourpkr.model;

import com.sampullara.poker.Card;

/**
 *
 * @author niboucha
 */
public class Carte {

    private int valeur;
    private int couleur;
    
    public Carte(int val,int coul){
        valeur = val;
        couleur = coul;
    }
    
    public String getEnglishName()
    {
        String result = "";
        switch(valeur){
            case 1 :
                result += "a";
                break;
            case 11 :
                result += "j";
                break;
            case 12 :
                result += "q";
                break;
            case 13 :
                result += "k";
                break;   
            case 10 :
                result += "t";
                break;
            default :
                result += valeur;
                
        }
        
        return result;
    }
    
    public String getEnglishColor()
    {
        String result = "";
        
         switch(couleur){
            case 4:
                result += "s";
                break;
            case 3:
                result += "h";
                break;
            case 1:
                result += "c";
                break;
            case 2:
                result += "d";
        }
         
        return result;
    }
    
    public String toString(){
        String result = "";
        switch(valeur){
            case 1 :
                result += "As";
                break;
            case 11 :
                result += "Valet";
                break;
            case 12 :
                result += "Dame";
                break;
            case 13 :
                result += "Roi";
                break;
            default :
                result += valeur;
                
        }
        result += " de ";
        switch(couleur){
            case 4:
                result += "Pique";
                break;
            case 3:
                result += "Coeur";
                break;
            case 1:
                result += "Trefle";
                break;
            case 2:
                result += "Carreau";
        }
        return result;
    }
    
    
    public int getCouleur() {
        return couleur;
    }

    public int getValeur() {
        return valeur;
    }

    public com.sampullara.poker.Card getLibCard()
    {
        Card.Rank cardRank = Card.Rank.parse( getEnglishName() );
        Card.Suit cardSuit = Card.Suit.parse( getEnglishColor() );
        
        Card c = new Card(cardRank,cardSuit);
        
        return c;
    }
    
    public void setCouleur(int couleur) {
        this.couleur = couleur;
    }

    public void setValeur(int valeur) {
        this.valeur = valeur;
    }
    
}
